import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Gao zhao xu
 * Date: 2023-11-06
 * Time: 8:02
 */

public class Test {
    public static int findNext(String P){
        int i = 0;
        int k = -1;
        int m = P.length();
        int[] next = new int[m + 1];
        next[0] = -1;
        while (i < m){
            if (k == -1 || P.charAt(k) == P.charAt(i)) next[++i] = ++k;
            else k = next[k];
        }
        return next[m];
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        while(!s.equals(".")){
            int L = s.length() - findNext(s);
            if (s.length() % L == 0){
                System.out.println(s.length() / L);
            }else{
                System.out.println(1);
            }
            s = in.nextLine();
        }
     }
}
